<template>
	<view>
		子组件
		<!-- <button @click="$emit('add',Math.random())">按钮</button> -->
		这才是常用
		<button @click="clickMost">按钮1</button>
		这才是常用2
		<button @click="clickMost2">按钮3</button>
		这才是常用3
		<button @click="clickMost3">按钮3</button>
		<input type="text" @input="oninput"/>
	</view>
</template>

<script setup>
	const emit = defineEmits(["add","add2","add3"],'change')
	function clickMost() {
		emit('add',Math.random())
	}
	function clickMost2() {
		emit('add2',Math.random())
	}
	function clickMost3() {
		emit('add3',Math.random())
	}
	function oninput(e) {
		emit('change',e.detail.value)
	}
</script>

<style>
input {
	border: 1px solid #cdcdcd;
	height: 44px;
}
</style>